<template>
<div class="page">
<div class="t-all">
   <img  class="timg" :src='tour.ssrc' @click="previewImg(tour)"/>
   <div class="tsbiao">{{tour.sbiao}}
    
   </div>
  
   <div @click="deletetour" class="shanchu" ><img src="https://my-wechatl.oss-cn-beijing.aliyuncs.com/%E5%88%A0%E9%99%A4.png"></div>
   
</div>
  </div>
</template>


<script>
import {post,showModel} from '@/utli'
export default {
  
     props: ['tour',
              ],

     methods:{
       //点击进入详情
        previewImg() {
         
       console.log("提交成功图片",this.tour.sid)
      
        },
    
       //收藏
        async deletetour(){

       console.log("提交成功收藏",this.tour.sid)
    //  console.log(this.userinfo.openId)
        try{
       const res= await post('/weapp/deletetour',{sid:this.tour.sid})
       console.log("从后端返回的执行正确的信息是:",res)
      showModel('提交成功',"反馈成功")
        // 成功后返回首页
      wx.reLaunch({
      url: '../tour/main' })
      // wx.switchTab({
      //   url: '../feedback/main'
      // })
     
    }catch(e){
      console.log("从后端返回的执行错误的信息是",e)
       showModel('提交失败',"服务器出错",e.data.msg)
    }
        }

     },
     mounted(){
      const userinfo =wx.getStorageSync('userinfo')
      if(userinfo.openId){
          this.userinfo = userinfo
          console.log("this.userinfo",this.userinfo)
      }
  }
}
</script>

<style lang='scss'>
.page{
  width:100%;
}

//整个框
.t-all{
  position: relative;
  height:100px;
  width:90%;
  float: left;
  margin-top: 10px;
  margin-left:20px;
   box-shadow: 0 0px 5px 0px silver;
  
  // border:1px solid red;
}
//图片
.timg{
  height:80px;
  width:30%;
   margin-top: 10px;
    margin-left: 10px;
//  border:1px solid blue;
 border-top-right-radius: 4px;
  border-top-left-radius: 4px;
}

//标题
.tsbiao{
  //上右下左
  position:absolute ;
   font-size: 15px;
   top: 10px;
    margin-left: 130px;
}

//收藏按钮样式
.shanchu{
  position:absolute ;
  height:60rpx;
  width:80rpx;
  bottom: 25rpx;
  margin-left: 280px;
  color:blue;
background-size: cover;
 img{
  height:40px;
  width:40px;
//  border:1px solid blue;
 border-top-right-radius: 4px;
  border-top-left-radius: 4px;
}
}
</style>
